import { serverCreater, requestCreater } from './request'

// 登录
export const adminLogin = requestCreater('/manage/login', 'POST')

// 查询全部权限
export const adminPermission = requestCreater('/manage/permission', 'GET')

// 查询角色权限
export const userPermission = requestCreater('/manage/user/permission', 'GET')

// 角色crud
export const roleServer = serverCreater('/manage/role')

// 上传文件
export const uploadFile = (data) => {
  const formData = new FormData();
  formData.append('file', data.file);
  return requestCreater('/manage/utils/upload?save_dir=' + encodeURIComponent(data.oss_path), 'POST', {
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  })(formData)
}

//开启||关闭用户
export const updateStatusUser = requestCreater('/manage/user/is_closed', 'put')

// 部门crud
export const departmentServer = serverCreater('/manage/department')

// 用户crud
export const userServer = serverCreater('/manage/user')

// 首页收回统计
export const indexQ1 = requestCreater('/manage/index/q1', 'get')

// 首页第二行统计
export const indexQ2 = requestCreater('/manage/index/q2', 'get')

// 首页查询跟进记录列表
export const indexQ3 = requestCreater('/manage/index/q3', 'get')
